package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.anno.AutoFill;
import com.sky.dto.SetmealDTO;
import com.sky.dto.SetmealPageQueryDTO;
import com.sky.entity.Setmeal;
import com.sky.entity.SetmealDish;
import com.sky.enums.AutoFillType;
import com.sky.vo.DishItemVO;
import com.sky.vo.SetmealHuiXianVO;
import com.sky.vo.SetmealPageVO;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface SetmealMapper {
    @Select("select * from setmeal where id=#{setmealId}")
     Setmeal getById(Long setmealId) ;

    @AutoFill(type = AutoFillType.INSERT)
        // @Insert("insert into setmeal(category_id, name, price, status, description, image, create_time, update_time, create_user, update_user)values (#{categoryId},#{name},#{price},#{status},#{description},#{image},#{createTime},#{updateTime},#{createUser},#{updateUser})")
    void addSetmeal(Setmeal setmeal);

    void addSetmealDish(List<SetmealDish> setmealDishes);

    Page<SetmealPageVO> page(SetmealPageQueryDTO SetmealPageQueryDTO);
    @Select("select * from setmeal where id=#{id}")
    Setmeal seleteById(Long id);

    void deletes(List<Long> ids);

    void deleteDish(List<Long> ids);

    SetmealHuiXianVO huixian(Long id);
    @AutoFill(type = AutoFillType.UPDATE)
    void update(Setmeal setmeal);
    @Delete("delete from setmeal_dish where setmeal_id=#{id}")
    void deleteSD(Long id);
    @Select("select * from setmeal where name=#{name}")
    Setmeal seleteByName(String name);

    List<Setmeal> seleteByCategoryId(@Param("status") Integer status,@Param("categoryId") Long categoryId);

    List<DishItemVO> getDishBymealId(Long setmealId);
}
